﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Web;
using System.Web.Mvc;


namespace Model
{
    

    [MetadataType(typeof(Quotation_Metadata))]
    [DisplayName("Quotation")]
    public partial class Quotation
    {
       
        public Quotation()
        {
            this.Id = Guid.NewGuid();
            this.UserId = new Guid(HttpContext.Current.User.Identity.Name);
            this.Number = "Ebyshow-" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day +"-"+ DateTime.Now.Hour + DateTime.Now.Minute + DateTime.Now.Second;
            this.DateTime = DateTime.Now;
        }

        public class Quotation_Metadata
        {
            [ScaffoldColumn(false)]
            public Guid Id { get; set; }


            [ScaffoldColumn(false)]
            public object Number { get; set; }

            [DisplayName("销售机会")]
            [DropDownList("SalesOpportunity", "Id", "ChanceName")]
            public object OportunityId { get; set; }

            [DisplayName("报价单阶段")]
            public object Stage { get; set; }

            [DisplayName("客户名称")]
            //[DropDownList("Customer", "Id", "CustomerName")]
            public object CustomerId { get; set; }

            [DisplayName("联系人")]
            //[DropDownList("CustomerContact", "Id", "Name")]
            public object CustomerContactId { get; set; }

            [DisplayName("负责人")]
            [DropDownList("Sys_Users", "Id", "UserName")]
            public object AdminId { get; set; }


            [DisplayName("付款条件")]
            //[DataType(DataType.MultilineText)]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            public object PayCondition { get; set; }

            [DisplayName("描述")]
            //[DataType(DataType.MultilineText)]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            public object Discription { get; set; }

            [DisplayName("税率")]
            [DisplayFormat(ConvertEmptyStringToNull = false)]
            public object Taxrate { get; set; }

            [DisplayName("总计")]
            [ScaffoldColumn(false)]
            public object Totale { get; set; }

            [DisplayName("报价日期")]
            [DataType(DataType.DateTime)]
            public object DateTime { get; set; }

            [ScaffoldColumn(false)]
            public Guid UserId { get; set; }

            //[DisplayName("标题")]
            //[Required]
            //public object Title { get; set; }



        }
    }
}
